<#include "../common/_layout.html"/>
<@layout>
       <div class="demo-block">
            <ul class="ui-list ui-border-tb ui-list-link" id="xs_list">
            	<#if infoPage??>
	            <#list infoPage.getList() as x>
					<li onclick="window.location='my/waitExamineDetail/${x.id}'">
	                    <div class="ui-list-info ui-border-t">
	                        <h4 class="ui-nowrap">
	                        [
	                        	<#if (x.type == 1)>招聘</#if>
	                        	<#if (x.type == 2)>房源</#if>
	                        	<#if (x.type == 3)>买卖</#if>
	                        	<#if (x.type == 4)>活动</#if>
	                        	<#if (x.type == 5)>问答</#if>
	                        ]
	                        ${x.title}</h4>
	                        <#if (x.type == 1)>
	                        	<p class="ui-nowrap" style="font-size: 8px;">${(x.company)!}</p>
	                        	<h5 class="ui-txt-highlight">${(x.price_range)!}</h5>
	                        </#if>
	                        <#if (x.type == 2 || x.type == 3 || x.type == 4)>
	                        	<p class="ui-nowrap" style="font-size: 8px;">${(x.address)!}</p>
	                        	<h5 class="ui-txt-highlight"><#if x.price??>${(x.price)!}元</#if></h5>
	                        </#if>
	                        
                        	<#if (x.pass_flag == -1)><h5 class="ui-txt-warning">审核未通过</h5></#if>
                        	<#if (x.pass_flag == 0)><h5 class="ui-txt-highlight">待审核 </h5></#if>
                        	<#if (x.pass_flag == 1)><h5 class="ui-txt-feeds">审核通过</h5></#if>
	                    </div>
	                </li>
				</#list>
				</#if>
            </ul>
            <!-- Loading Start -->
			<div id="xs_load" style="width:110px;height:37px;margin:0 auto;text-align: center;display:none;" class="clearfix">
				 <span style="color:#777;font-size:12px; margin-top: 5px;text-align:center;margin-top:10px;display:none;">松开加载更多</span>
		  	</div>
			<!-- Loading End -->
			<input type="hidden" id="xs_total" value="${(infoPage.totalRow)!}" />
        </div>

<script class="demo-script">
var page = 2,_limit=10,_total=0,curr_total=10,is_exe=true;
var _loadHtml = '<div  id="_loading" style="font-size:12px;text-align:center;margin-top:20px;"><img src="static/frozenui/img/loading_img.gif" style="width:20px;height:20px;vertical-align:middle;margin-right:5px;">加载中,请稍等</div>';
var _loadMore = '<span  id="_load_more" style="color:#777;font-size:12px;">松开加载更多</span>';
var _noData = '<span  id="_no_data" style="color:#777;font-size:12px;">暂无数据</span>';

$(function(){
	_total = parseInt($("#xs_total").val());
	if(_total > curr_total){$('#xs_load').show()}else{is_exe=false;};
	//auto load
	var offsettop = 800;
	document.onscroll = function(){
	   var xs_div = document.getElementById('xs_list');
	   var xs_d_h = xs_div.scrollHeight;
	   var docTop = document.body.scrollTop | document.documentElement.scrollTop;
	    docTop += offsettop;
	   if(docTop > xs_d_h){
		  if(is_exe){
			  is_exe = false;
			  $('#xs_load').html('').append(_loadHtml);
			  setTimeout('loadMore()',300);
		  }
	   }
	};
})

//加载更多
function loadMore(){
	var params = {};
	params.page = page;
	$.post("my/waitExamineAjax",params,function(mes){
		if(mes.code == 200) {
			var _data = mes.data.list;
			_total = mes.data.totalRow;
			var _html = '';

			$.each(_data,function(k,v){
				var href = 'onclick=window.location="my/waitExamineDetail/'+v.id+'"';
				_html += '<li '+href+'>'+
						 	'<div class="ui-list-info ui-border-t">'+	
		                    '<h4 class="ui-nowrap">'+v.title+'</h4>'+
		                    '<p class="ui-nowrap" style="font-size: 8px;">'+v.company+'</p>'+
		                    '<h5 class="ui-txt-highlight">'+v.price_range+'</h5>'+
		                '</div></li>';
			});
			
			//无数据判定Start
			if(page == 1 && _total == 0){
				$('#xs_load').append(_noData);
			}
			//无数据判定End
			//判定是否有跟多数据Start
			curr_total = page * _limit;
			if(curr_total < _total){
				is_exe = true;
				page++;
				$('#xs_load').append(_loadMore);
			}

			//判定是否有跟多数据End
			if(page == 1){
				$('#xs_list').html('').append(_html);
			}else{
				$('#xs_list').append(_html);
			}
			$('.ui-loading-block').remove();		
		}else{
			var el;
			el=$.tips({
				content:'服务器繁忙...',
				stayTime:2000,
				type:"info"
			});
		}

		$("#_loading").remove();
	});
}
</script>

</@layout>